1.3. Using Verbs
SharePoint uses common verbs that you have seen with other sets of cmdlets;
there are also a number of new verbs added in SharePoint that you may
not have seen. Again, you can find these by using the Get-Command cmdlet, as shown here.
PS C:\Users\Peter>Get-Command -PSSnapin "Microsoft.SharePoint.PowerShell" |
>>sort verb | group verb | sort count -descending
>><ENTER>
Count Name Group
----- ---- -----
139 Get {Get-PluggableSecurityTrimmer, Get-SPAccessS...
104 Set {Set-SPAccessServiceApplication, Set-SPAlter...
88 New {New-SPAccessServiceApplication, New-SPAlter...
77 Remove {Remove-PluggableSecurityTrimmer, Remove-SPA...
11 Update {Update-SPFarmEncryptionKey, Update-SPInfoPa...
10 Add {Add-PluggableSecurityTrimmer, Add-SPClaimTy...
10 Install {Install-SPApplicationContent, Install-SPDat...
8 Start {Start-SPAdminJob, Start-SPAssignment, Start...
8 Import {Import-SPBusinessDataCatalogModel, Import-S...
8 Export {Export-SPBusinessDataCatalogModel, Export-S...
8 Uninstall {Uninstall-SPDataConnectionFile, Uninstall-S...
7 Disable {Disable-SPBusinessDataCatalogEntity, Disabl...
6 Enable {Enable-SPBusinessDataCatalogEntity, Enable-...
6 Clear {Clear-SPLogLevel, Clear-SPMetadataWebServic...
5 Stop {Stop-SPAssignment, Stop-SPEnterpriseSearchQ...
4 Move {Move-SPBlobStorageLocation, Move-SPProfileM...
3 Initialize {Initialize-SPContentDatabase, Initialize-SP...
3 Upgrade {Upgrade-SPContentDatabase, Upgrade-SPEnterp...
3 Backup {Backup-SPConfigurationDatabase, Backup-SPFa...
3 Restore {Restore-SPEnterpriseSearchServiceApplicatio...
2 Resume {Resume-SPEnterpriseSearchServiceApplication...
2 Test {Test-SPContentDatabase, Test-SPInfoPathForm...
2 Suspend {Suspend-SPEnterpriseSearchServiceApplicatio...
2 Revoke {Revoke-SPBusinessDataCatalogMetadataObject,...
2 Mount {Mount-SPContentDatabase, Mount-SPStateServi...
2 Grant {Grant-SPBusinessDataCatalogMetadataObject, ...
2 Dismount {Dismount-SPContentDatabase, Dismount-SPStat...
1 Merge {Merge-SPLogFile}
1 Receive {Receive-SPSharedServiceApplicationInfo}
1 Disconnect {Disconnect-SPConfigurationDatabase}
1 Unpublish {Unpublish-SPServiceApplication}
1 Connect {Connect-SPConfigurationDatabase}
1 Rename {Rename-SPServer}
1 Restart {Restart-SPEnterpriseSearchQueryComponent}
1 Copy {Copy-SPBusinessDataCatalogAclToChildren}
1 Ping {Ping-SPEnterpriseSearchContentService}
1 Publish {Publish-SPServiceApplication}
As you can see, the most common SharePoint–related verbs are
Get
Queries a specific object or a collection of object and retrieves
information concerning that object. For example, you could use it to
retrieve information on all service applications. Only Get commands
return one or more objects; all other commands execute on one object at
a time.
Get-SPServiceApplication
Set
Modifies specific settings of an object. For example, you could use it
to set the site collection owner for a specific site collection.
Set-SPSite http://teams -OwnerAlias contoso\peter
New Creates a new instance of an object, such as creating a new site collection.
New-SPSite http://teams/sites/HR -OwnerAlias contoso\peter
-Name "HR Team" -Template STS#0
Remove
Removes (deletes) an instance of the object, such as a site collection
and all its subsites. Because of the dangerous nature of this verb, you
usually have to confirm this action by using the –confirm parameter. If this parameter is not present, you will see a message asking you to confirm the action, as shown here.
PS C:\Users\Peter> Remove-SPSite http://teams/sites/HR
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-SPSite" on Target "http://teams/sites/Finance".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):y
Parameters are used throughout the examples shown here. These are the words prefixed with a hyphen (–). In the next section, you will look at the Get-Help
cmdlet and learn how it can help you find out more about these
parameters, including which parameters are available for use with
different cmdlets.